package client.communication;

import java.io.PrintWriter;
import java.net.Socket;

public class MessageProcessorThread extends Thread{

	private Socket socket;
	private String input;
	private MessageProcessor msProc;
	private PrintWriter out;
	public MessageProcessorThread(Socket socket, String input) throws Exception
	{
		this.socket = socket;
		this.input = input;
		msProc = new MessageProcessor();
		msProc.servSocket = socket;
		out = new PrintWriter(socket.getOutputStream(), true);
	}
	
	@Override
	public void run()
	{
		String answer = msProc.process(input);
		if (answer != null)
		{
			System.out.println("OUTPUT: "+answer);
			out.println(answer);
		}
	}
	
}
